from django.shortcuts import render

# Create your views here.
from django.views import View

from courses.models import Course, BannerCourse
from organization.models import CourseOrg
from users.models import Banner
from boxuegu.settings import MEDIA_URL


class IndexView(View):
    def get(self, request):
        all_banners = [banner for banner in Banner.objects.all()]
        courses = [course for course in Course.objects.all()]
        banner_courses = [bc for bc in BannerCourse.objects.all()]
        course_orgs = [co for co in CourseOrg.objects.all()]
        return render(request, 'index.html', {
            'all_banners': all_banners,
            'courses': courses,
            'banner_courses': banner_courses,
            'course_orgs': course_orgs,
            'MEDIA_URL': MEDIA_URL
        })
